package com.java.mytools.common.base.entity;

public class RespMessage {

  private Boolean success;
  private Integer status;
  private String msg;
  private Object data;

  private RespMessage() {
  }

  public static RespMessage build() {
    return new RespMessage();
  }

  public static RespMessage build(Boolean success, Integer status, String msg) {
    return new RespMessage().setSuccess(success).setStatus(status).setMsg(msg);
  }

  public static RespMessage build(Boolean success, Integer status, Object data) {
    return new RespMessage().setSuccess(success).setStatus(status).setData(data);
  }

  public static RespMessage build(Boolean success, Integer status, String msg, Object data) {
    return new RespMessage().setSuccess(success).setStatus(status).setMsg(msg).setData(data);
  }

  public static RespMessage ok() {
    return new RespMessage().setSuccess(true).setStatus(200);
  }

  public static RespMessage ok(String msg) {
    return new RespMessage().setSuccess(true).setStatus(200).setMsg(msg);
  }

  public static RespMessage ok(Object data) {
    return new RespMessage().setSuccess(true).setStatus(200).setData(data);
  }

  public static RespMessage ok(String msg, Object data) {
    return new RespMessage().setSuccess(true).setStatus(200).setMsg(msg).setData(data);
  }

  public static RespMessage error(String msg) {
    return new RespMessage().setSuccess(false).setStatus(500).setMsg(msg);
  }

  public static RespMessage error(String msg, Object data) {
    return new RespMessage().setSuccess(false).setStatus(500).setMsg(msg).setData(data);
  }


  public Boolean getSuccess() {
    return success;
  }

  public RespMessage setSuccess(Boolean success) {
    this.success = success;
    return this;
  }

  public Integer getStatus() {
    return status;
  }

  public RespMessage setStatus(Integer status) {
    this.status = status;
    return this;
  }

  public String getMsg() {
    return msg;
  }

  public RespMessage setMsg(String msg) {
    this.msg = msg;
    return this;
  }

  public Object getData() {
    return data;
  }

  public RespMessage setData(Object data) {
    this.data = data;
    return this;
  }

  @Override
  public String toString() {
    return "RespMessage{" +
            "success=" + success +
            ", status=" + status +
            ", msg='" + msg + '\'' +
            ", data=" + data +
            '}';
  }
}
